// Dep：依赖，管理某个key相关所有Watcher实例
export class Dep {
  constructor() {
    this.deps = [];
  }

  addDep(dep) {
    console.log('addDep::');
    writeObj(dep);
    this.deps.push(dep);
  }
  notify() {
    this.deps.forEach(dep => {
      console.log('notify::dep:' + dep);
      dep.update();
    });
  }
}

function writeObj(obj) {
  var description = '';
  for (var i in obj) {
    var property = obj[i];
    description += i + ' = ' + property + '\n';
  }
  console.log(description);
}
